package net.lab1024.sa.admin.module.business.category.service;

import net.lab1024.sa.admin.module.business.category.domain.entity.UserContext;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Service
public class UserCacheService {
    private final Map<String, UserContext> userCache = new ConcurrentHashMap<>();

    public void cacheUser(String userId, UserContext userContext) {
        userCache.put(userId, userContext);
    }

    public UserContext getCachedUser(String userId) {
        return userCache.get(userId);
    }

    public void removeUser(String userId) {
        userCache.remove(userId);
    }
}